package operator;

import arbori.Nod;
/**
 * @author Feri
 */
/**
 *  This class is calculates the result of a<br /> <br /> 
 *  <ol>
 *  <li> (-) subtraction or </li> <br />
 *  <li> (+) an amount or </li> <br />
 *  <li> (/) a division or</li><br />
 *  <li> (*) a multiplication</li><br />
 *  </ol>
 *   <br />
 * 	For the complete project description (in Romanian)<br />
 * See <A href="https://sites.google.com/site/sabloanedeproiectare/refactoring" > Design Patterns Lab </A>
 */
public abstract class Operator extends Nod{
	/**
	 * @return Returns the value result of the calculation
	 */
	public double calcul(){
		if ((getfStang() == null) || (getfDrept() == null))
			System.exit(0);
		return this.calcul(getfStang().calcul(), getfDrept().calcul());
	}
	/**
	 * @return Returns the concatenated right son + right son
	 */
	public String toString (){
		if ((getfStang() == null) || (getfDrept() == null))
			System.exit(0);
		return this.concatTermeni(getfStang().toString(), getfDrept().toString());
	}
	public abstract double calcul(double aux1, double aux2);
	public abstract String concatTermeni (String aux1, String aux2);
}
